package demo6;

/**
 * @author Huangjin
 * @version 1.0
 * describe:
 * @date 2023/2/27 19:04
 */
public class EnumDemo {
    public static void main(String[] args) {
        //获取所有枚举的对象
        Season[] seasons = Season.values();
        for (int i = 0; i < seasons.length; i++) {
            //输出4个枚举对象（SPRING、SUMMER、AUTUMN、WINTER）
            System.out.println(seasons[i]);
            //输出枚举的名字属性
            System.out.println(seasons[i].getSeasonName());
            //输出枚举的描述属性
            System.out.println(seasons[i].getSeasonDesc());
        }
        //获取WINTER对象
        Season s = Season.WINTER;
        System.out.println(s.getSeasonName()+","+s.getSeasonDesc());
        switch (s){
            case SPRING:
                System.out.println("天气"+s.getSeasonDesc()+",去放风筝咯！");
                break;
            case SUMMER:
                System.out.println("天气"+s.getSeasonDesc()+",游泳去咯！");
                break;
            case AUTUMN:
                System.out.println("天气"+s.getSeasonDesc()+",摘苹果去咯！");
                break;
            case WINTER:
                System.out.println("天气"+s.getSeasonDesc()+",打雪仗去咯！");
                break;
            default:
        }
    }
}
